package com.itheima.mapper;

import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

/**
 * @version 1.0
 * @Author 郭腾高
 * @Date 2024/9/4 20:34
 */
@Mapper
public interface EmpMapper {

    //Select可以注释掉
    @Select("select * from emp")
    public List<Emp> list(String name,Short gender, LocalDate begin, LocalDate end);

    void delete(List<Integer> ids);
    @Insert("insert into emp(username, name, gender, image, job, entrydate, dept_id, create_time, update_time) " +
            "values (#{username},#{name},#{gender},#{image},#{job},#{entrydate},#{deptId},#{createTime},#{updateTime})")
    void insert(Emp emp);
    @Select("select * from emp where id=#{id}")
    Emp selectById(Integer id);

    @Update("update emp set username=#{username},name=#{name},gender=#{gender},image=#{image},job=#{job},entrydate=#{entrydate},dept_id=#{deptId} where id=#{id}")
    void update(Emp emp);
    @Select("select * from emp where username=#{username} and password=#{password}")
    Emp getByUsernameAndPassword(Emp emp);
    @Delete("delete from emp where dept_id=#{deptId}")
    void deleteById(Integer deptId);
}
